package learn1;

public class Student extends  Object{
    public String name;
    public int age;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //重写equals方法
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (this.getClass() != obj.getClass()) {
            return false;
        }
        Student s = (Student) obj;
        if (this.name == s.name && this.age == s.age) {
            return true;
        }
        return false;
    }

    public String toString() {
        return "name = " + name + ", age = " + age;
    }
}
